<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="css/index.css">
    <script src="./js/index.js"></script>
</head>

<body>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        a {
            text-decoration: none;
        }

        .box {
            width: 1200px;
            height: 370px;
            margin: 0 auto;

        }

        .box1 {
            height: 50px;

        }


        h3 {


            margin-left: 50px;
            float: left;
        }

        .txt {
            list-style: none;
            color: #e6e6e6;
            margin-top: 13px;
            width: 60px;
            height: 26px;
            line-height: 26px;
            text-align: center;
            cursor: pointer;
            float: left;
            margin-left: 5px;
        }

        .sanjiao {
            display: block;
            background-image: url(images/d.png);
            background-position: -326px -168px;
            background-size: 475px;
            width: 11px;
            height: 4px;
            margin-left: 20px;
            display: none;
        }


        .txt:hover .sanjiao {
            display: block;

        }

        .txt:hover {
            background-color: #333333;
            color: #cab17d;
        }


        .txt1 {
            text-decoration: none;
            color: #ccc;
            font-size: 14px;
            float: right;
            margin-right: 50px;
            margin-top: 15px;
        }

        .box2 {
            width: 1200px;
            height: 320px;

        }

        .box2 ul {
            width: 360px;
            height: 320px;
        }


        .box2 .img {
            width: 1120px;
            height: 300px;
            margin: 0 40px;
        }

        .imgbox {

            height: 300px;
            width: 360px;
            float: left;
            margin-left: 30px;
            position: relative;
            cursor: pointer;



        }

        .imgbox .main {
            float: left;
            display: none;
        }

        .imgbox .main.selected {
            display: block;
        }

        img {
            width: 360px;
            height: 300px;

        }

        .imgbox:hover img {

            height: 320px;
            transition: all .5s ease
        }

        .imgbox p {
            position: absolute;
            left: 10px;
            bottom: -9px;
            color: #fff;
            font-size: 22px;
        }

        .jinatou {
            color: #fff;
            font-size: 24px;
            position: absolute;
            line-height: 50px;
            text-align: center;
            left: 15Px;
            top: 50%;
            width: 40px;
            height: 50px;
            border-radius: 0 10px 10px 0;
            background-color: #d9d9d9
        }

        .jiantou1 {
            color: #fff;
            font-size: 24px;
            position: absolute;
            line-height: 50px;
            text-align: center;
            right: -16px;

            top: 50%;
            width: 40px;
            height: 50px;
            border-radius: 10px 0 0 10px;
            background-color: #d9d9d9
        }
    </style>
</body>

<div class="box">
    <div class="box1">
        <h3>排行榜</h3>
        <li class="txt active">男表
            <i class="sanjiao"></i>
        </li>
        <li class="txt">女表
            <i class="sanjiao"></i>
        </li>
        <li class="txt">湖表
            <i class="sanjiao"></i>
        </li>
        <a href="" class="txt1">查看更多>></a>
    </div>

    <div class="box2">


        <ul class="imgbox">
            <li class="main selected"> <a href="javascript:void(0)"><img
                        src="images/54943392a6734305bb1561729bf31b7f.png" alt=""></a>
            </li>
            <li class="main"> <a href="javascript:void(0)"><img src="images/4e0c704fbeb349d7834f937b53fd6f2c.jpg"
                        alt=""></a>
            </li>
            <li class="main"> <a href="javascript:void(0)"><img src="images/d63aec1aadcc427ea3d414e6f4fb943b.jpg"
                        alt=""></a>
            </li>
            <p>炫酷机械 洞察新潮流</p>
            <div class="jinatou">&gt;</div>

        </ul>

        <ul class="imgbox">
            <li class="main selected"> <a href="javascript:void(0)"><img
                        src="images/54943392a6734305bb1561729bf31b7f.png" alt=""></a>
            </li>
            <li class="main"> <a href="javascript:void(0)"><img src="images/4e0c704fbeb349d7834f937b53fd6f2c.jpg"
                        alt=""></a>
            </li>
            <li class="main"> <a href="javascript:void(0)"><img src="images/d63aec1aadcc427ea3d414e6f4fb943b.jpg"
                        alt=""></a>
            </li>
            <p>炫酷机械 洞察新潮流</p>

        </ul>

        <ul class="imgbox">
            <li class="main selected"> <a href="javascript:void(0)"><img
                        src="images/54943392a6734305bb1561729bf31b7f.png" alt=""></a>
            </li>
            <li class="main"> <a href="javascript:void(0)"><img src="images/4e0c704fbeb349d7834f937b53fd6f2c.jpg"
                        alt=""></a>
            </li>
            <li class="main"> <a href="javascript:void(0)"><img src="images/d63aec1aadcc427ea3d414e6f4fb943b.jpg"
                        alt=""></a>
            </li>
            <p>炫酷机械 洞察新潮流</p>
            <div class="jiantou1">&lt;</div>

        </ul>



    </div>
</div>
<script>
    var oBox1 = document.querySelectorAll(".box1 li");
    var oMains = document.querySelectorAll(".imgbox .main");

    for (var i = 0; i < oBox1.length; i++) {
        oBox1[i].tempIndex = i;
        oBox1[i].onclick = function () {
            //点击后,排他,遍历清除所有的 active类名称
            for (var j = 0; j < oBox1.length; j++) {
                oBox1[j].className = "txt";
                oMains[j].className = "main";

            }
            this.className = "txt active";
            //下标对应
            oMains[this.tempIndex].className = "main selected"
        }
    }

</script>

</html>